﻿using PLC;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using 际海环境软件.Class;

namespace 际海环境软件.Forms
{
    public partial class RegistForm : Form
    {
        public RegistForm()
        {
            InitializeComponent();
        }

        private void RegistForm_Load(object sender, EventArgs e)
        {
            textBox1.Text = RegistService.md5key;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                RegistFileHelper.WriteRegistFile(textBox2.Text);

                if (RegistFileHelper.CheckRegistData(RegistService.md5key) == true)
                {
                    MessageBox.Show("注册成功～");
                    //Form1.Logger.Info("***********注册成功***********");
                    Form1.isRegist = true;
                    this.Close();                  
                }
                else
                {
                    //Form1.Logger.Info("***********注册失败***********" );
                    Form1.isRegist = false;
                }
            }
            catch(Exception ex)
            {
                //Form1.Logger.Error("注册错误  " + ex.ToString());
                Form1.isRegist = false; 
            }
        
        }
    }
}
